package vn.qnamuni.calendar.db;

import vn.qnamuni.calendar.constants.PersonContract;
import android.database.sqlite.SQLiteDatabase;

public class PersonTable {
	// Contacts table name
	public static final String TABLE_CONTACTS = "CONTACT";

	public static final void onCreate(SQLiteDatabase db) {
		String CREATE_CONTACTS_TABLE = "CREATE TABLE IF NOT EXISTS "
				+ TABLE_CONTACTS + "(" + PersonContract.Entry.KEY_ID
				+ " INTEGER PRIMARY KEY autoincrement,"
				+ PersonContract.Entry.KEY_UID + " TEXT DEFAULT 'LOCAL',"
				+ PersonContract.Entry.KEY_NAME + " TEXT NOT NULL,"
				+ PersonContract.Entry.KEY_USERNAME + " TEXT,"
				+ PersonContract.Entry.KEY_DATE + " TEXT,"
				+ PersonContract.Entry.KEY_IS_NOTI + " TEXT DEFAULT '0',"
				+ PersonContract.Entry.KEY_TIME + " TEXT DEFAULT '07:00:00',"
				+ PersonContract.Entry.KEY_EVENT_ID + " TEXT,"
				+ PersonContract.Entry.KEY_AVATAR + " TEXT,"
				+ PersonContract.Entry.KEY_PHONE + " TEXT,"
				+ PersonContract.Entry.KEY_MODE + " TEXT DEFAULT '2',"
				+ PersonContract.Entry.KEY_MESSAGE + " TEXT DEFAULT '"
				+ PersonContract.DEFAULT_SMS + "');";
		db.execSQL(CREATE_CONTACTS_TABLE);
	}

	public static final void onUpgrade(SQLiteDatabase db, int oldVersion,
			int newVersion) {
		// Drop older table if existed
		db.execSQL("DROP TABLE IF EXISTS " + TABLE_CONTACTS);

		// Create tables again
		onCreate(db);
	}
}

